import listStatus from '../../tabBar/public/js/way-list-status.js';
export default {
	data() {
		return {
			orderList: [], //列表数据 
		};
	},
	props: {
		journey_id: {
			// 当前tab的下标 (除了支付宝小程序必须在这里定义, 其他平台都可不用写, 因为已在MescrollMoreItemMixin定义)
			type: String,
			default () {
				return 0;
			}
		},
	},
	created() {
		//加判断 编辑页来的，请求列表接口
		// #ifdef MP-WEIXIN
		if (wx.getUserProfile) this.canIUseGetUserProfile = true;
		// #endif
	},
	onShow(){
		this.getOrderListData();
	},
	methods: {
		getDepartPic1(rows) {
			return listStatus.getDepartPic1(rows);
		},
		getDepartPic2(rows) {
			return listStatus.getDepartPic2(rows);
		},
		getArrivePic1(rows) {
			return listStatus.getArrivePic1(rows);
		},
		getAllocatePic1(rows) {
			return listStatus.getAllocatePic1(rows);
		},
		getAllocatePic2(rows) {
			return listStatus.getAllocatePic2(rows);
		},


		getLevel(rows) {
			return listStatus.getLevel(rows);
		},
		getDestinationCity(rows) {
			return listStatus.getDestinationCity(rows);
		},
 
		carLoading(e) {
			this.$util.redirectTo('/pages/order/order-confirm/order-arrive-confirm', e, null, 'obj');
		}, 
		
		toDetail(item) {
			this.$util.redirectTo('/pages/order/order-detail/order-detail', {
				waybill_id: item.waybill_id,
				in_type: '2',
			});
		},

		getOrderListData() {
			var param = {}
			let level = uni.getStorageSync(this.preutils.accountLevel);
			if (level == 1) {
				param = {
					journey_id_p1: this.journey_id
				} 
			} else if (level == 2) {
				 
			} else {
				param = {
					journey_id: this.journey_id
				}  
			}
			this.http.sendRequest({
				api: this.api.order.allocationList,
				data: param,
				success: res => {
					let msg = res.message;
					if (res.code == '1' && res.data) {
						this.orderList = res.data.data;
						 // for(var i=0;i<8;i++){
							//  this.orderList.push({})
						 // }
					} else {
						this.$util.showToast({
							title: msg
						});
					}
					if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
				},
				fail: res => {
					if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
				}
			});
		},
	}
};